import ajax from '@/utils/ajax';

export function doUserStatus(username) {
  return ajax({
    url: '/protal/websocket/get/on/line/status',
    hideLoading: true,
    params: { username }
  });
}

export function doSessionList(username, hideLoading) {
  return ajax({
    url: '/protal/websocket/get/session/list',
    hideLoading,
    params: { username }
  });
}

export function doSessionHistory(selfUsername, oppositeUsername, currentPageIndex) {
  return ajax({
    url: '/protal/websocket/get/more/history',
    params: { selfUsername, oppositeUsername, currentPageIndex }
  });
}

export function doSendMessage(fromUsername, toUsername, msg) {
  return ajax({
    url: '/protal/websocket/leave/word',
    method: 'post',
    data: { fromUsername, toUsername, msg }
  });
}
